<?php



include_once 'conn_login.php';
 if($_REQUEST['fun']=='login')
{
	$user_name=trim($_POST['user_name']);
	$password=trim($_POST['password']);

	if(!$user_name || !$password)
	{

		header('Location: login.php?error=1');exit();
	}

	$sql="select user_id,ec_salt from ecs_admin_user where user_name='$user_name'";
	$query = mysql_query($sql);
	$row=mysql_fetch_array($query);
	$ec_salt=$row['ec_salt'];



	$pwd=md5(md5($password).$ec_salt);
	
	$sql="select user_id,user_name from ecs_admin_user where user_name='$user_name' and  password='$pwd'";
	$query = mysql_query($sql);
	$row=mysql_fetch_array($query);
	$user_id=$row['user_id'];
	$user_name=$row['user_name'];


	if($user_id){		
        $_SESSION['user_id']=$user_id;
        $_SESSION['user_name']=$user_name;
		header('Location: youke_info.php');
		exit();
	}
	else
	{
		$_SESSION['user_id']='';
		
		header('Location:login.php?error=2');
		exit();
	}
		// header('Location: http://haining.365jinbi.com/lvxingtianxia/Admin/login.php');

}
else if($_REQUEST['fun']=='lgout')
{
	$_SESSION['user_id']='';
	$_SESSION['user_name']='';
		
	header('Location: login.php');
	exit();
}



include_once 'conn_mysql.php';
if($_REQUEST['fun_1']==1)
{
	 //超时1小时的放弃订单
	$now_time=time();

	$date_str=date("Y-m-d H:i:s",($now_time-3600));
	$now_date=date("Y-m-d H:i:s",$now_time);


	$sql="update  main_user set is_zhifu='2',del_time='$now_date' where is_zhifu=0 and issuetime<='$date_str'";
	$query = mysql_query($sql);
	header('Location: dingdan_info.php');
	exit();


}


header('Location: login.php');exit();
?>







